package com.quan.TemplateEditor.controller;

import com.quan.TemplateEditor.entity.User;
import com.quan.TemplateEditor.interfaces.userInterface;
//import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/user")
public class userController {
    @Autowired
    userInterface userInterface;

    /**
     * http://localhost:8089/aweb/user/getUser?id=1
     * @param id
     * @return
     */
    @RequestMapping(value = "/getUser")
    @ResponseBody
    User getUser(@RequestParam("id") String id) {
        //String user = userUtils.getUser();
        User user = userInterface.getUser(id);
        //User user=new User();
        /*user.setRid("1");
        user.setName("zequan");*/
        return user;
    }

    /**
     *
     * @return
     */
    @RequestMapping(value = "/test")
    @ResponseBody
    String test() {
        return "testluzequan";
    }

}
